<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jsp/include/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><%=system_name%> - 供应商产品报价管理</title>
	<%@include file="/WEB-INF/jsp/include/meta.jsp"%>
	
	<link href="<%=basePath%>css/common.css" rel="stylesheet" type="text/css" />
	<script src="<%=basePath%>js/common.js" type="text/javascript"></script>
	<script type="text/javascript" src="js/pagebar.js"></script>
	<script type="text/javascript" src="fram/engine.js" ></script>
	<script type="text/javascript" src="fram/util.js" ></script>
	<script type="text/javascript" src="fram/interface/supplierQuotationService.js"></script>
</head>

<body oncontextmenu='return false'>

<div class="wrap100 content">
    
    <!--right begin-->
	<div class="right">
        <div class="search">
                <form action="<%=basePath%>trade/userList" method="GET">
                <table width="100%" border="0" cellspacing="0" cellpadding="5">
                  <tr>
                    <td width="5%"><img src="images/marking1.gif" width="41" height="44" alt="marking" /></td>
                    <td width="8%">快速查询</td>
                    <td width="45%">请输入供应商名称：<input type="text" name="name" value="${userSearchCond.userName}" style="width:200px;" /></td></td>
                    <td width="11%">
                    <input type="submit" style="background:url(images/searchBtn.gif);width:116px;height:30px;border:0;margin:0;" value="" />
                    </td>
                    <td width="30%">
                    <jsp:useBean id="nowDate" class="java.util.Date"></jsp:useBean>
   					 现在是：${formatDate}<fmt:formatDate value="${nowDate}" type="both" dateStyle="full"/>
   					</td>
                    <td width="1%">&nbsp;</td>
                  </tr>
                </table>    
                </form>
        </div>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="60"><h1>供应商产品报价管理</h1></td>
              </tr>
            </table>
            <div class="rightContentTop">
              <div class="subMenu">
                <ul>
                  <li><a href="#" class="current">供应商产品报价列表</a></li>
                </ul>
              </div>
   		    </div>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="right"><span style="float:left;color:#666;">共找到<font color="red"> ${searchStat.totalCount} </font>条记录</span><a href="#"><a href="javascript:;" onclick="addQuotation()" style="font-weight:bold"><img src="images/add.gif" width="90" height="31" alt="添加" /></a></td>
              </tr>
            </table>
            <div class="rightContent1">
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr class="td">
                  <th width="5%" align="center" bgcolor="#f9f9f9"><input type="checkbox" name="checkbox4" id="checkbox4" /></th>
                  <th width="10%" align="center" bgcolor="#f9f9f9">货号</th>
                  <th width="10%" align="center" bgcolor="#f9f9f9">价格</th>
                  <th width="10%" align="center" bgcolor="#f9f9f9">品质规格</th>
                  <th width="５%" align="center" bgcolor="#f9f9f9">外包装长</th>
                  <th width="５%" align="center" bgcolor="#f9f9f9">宽</th>                  
                  <th width="5%" align="center" bgcolor="#f9f9f9">高</th>
                  <th width="5%" align="center" bgcolor="#f9f9f9">毛重</th>
                  <th width="5%" align="center" bgcolor="#f9f9f9">净重</th>
                  <th width="5%" align="center" bgcolor="#f9f9f9">箱个数</th>
                  <th width="5%" align="center" bgcolor="#f9f9f9">柜数量</th>
                  <th width="10%" align="center" bgcolor="#f9f9f9">报价时间</th>
                  <th width="20%" align="center" bgcolor="#f9f9f9">操作</th>
                </tr>
                <c:forEach var="data" items="${quotationList}">
                <tr>
                  <td align="center"><input type="checkbox" name="checkbox" id="checkbox" /></td>
                  <td align="center">${data.product.productNo}</td>
                  <td align="center">${data.price}</td>
                  <td align="center">${data.qualitySpecifications}</td>
                  <td align="center">${data.packingLong}</td>
                  <td align="center">${data.packingwidth}</td>
                  <td align="center">${data.packingHeight}</td>
                  <td align="center">${data.grossWeight}</td>
                  <td align="center">${data.netWeight}</td>
                  <td align="center">${data.boxes}</td>
                  <td align="center">${data.cabinet}</td>
                  <td align="center"><fmt:formatDate value="${data.quoteTime}" pattern="yyyy-MM-dd"/></td>
                  <td align="center">
                  	<a href="javascript:;" onclick="delQuotation('${data.id}')"><img src="images/del1.jpg" alt="详细" /></a>
                  	<a href="javascript:;" onclick="editQuotation('${data.id}')"><img src="images/modify.jpg" alt="修改" /></a>
                  	<a href="javascript:;" onclick="delQuotation('${data.id}')"><img src="images/del1.jpg" alt="删除" /></a>                  	
                  </td>
                </tr>
                </c:forEach>
				<c:if test="${empty userList}"><tr><td colspan="6" style="text-align:center">没有相关记录！</td></tr></c:if>
              </table>
            </div>
           
            <script type="text/javascript">
				var pageControl = new wpagebar('pageControl');
				pageControl.argName = "pageIndex";
				pageControl.pageCount =${searchStat.pageCount};
				pageControl.load();		
		  	</script>
	          
    <div id="win_temp" style="display:none">
	<div id="winCon_1">
	<table class="tabView" style="margin-top:5px">
		<tr><th width="100">供应商：</th><td colspan="3"><input type="text" name="supplierName0" id="supplierName0" value="" size="40"/>
			<input type="hidden" name="quotationId0" id="quotationId0" />
			<input type="hidden" name="supplierId0" id="supplierId0" value=""/>			
			</td></tr>
		<tr><th>产品货号：</th><td colspan="3"><input type="text" name="account0" id="account0" size="40"/>
			<input type="hidden" name="productId0" id="productId0" value=""/></td></tr>
		<tr><th>价格：</th><td><input type="text" name="code0" id="code0" value=""/></td>
			<th>品质规格：</th><td><input type="text" name="telphone0" id="telphone0" value=""/></td></tr>
		<tr><th>长：</th><td><input type="text" name="code0" id="code0" value=""/></td>
			<th>宽：</th><td><input type="text" name="telphone0" id="telphone0" value=""/></td></tr>			
		<tr><th>高：</th><td><input type="text" name="code0" id="code0" value=""/></td>
			<th>报价时间：</th><td><input type="text" name="entryDate0" id="entryDate0" value="" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})"/></td></tr>
		<tr><th>毛重：</th><td><input type="text" name="telphone0" id="telphone0" value=""/></td>
			<th>净重：</th><td><input type="text" name="code0" id="code0" value=""/></td>
		</tr>
		<tr><th>箱个数：</th><td><input type="text" name="telphone0" id="telphone0" value=""/></td>
			<th>柜个数：</th><td><input type="text" name="code0" id="code0" value=""/></td>
		</tr>
		<tr><td colspan="4" style="text-align:center;height:"><input type="button" value=" 提 交 " class="btn1" onclick="submitQuotation()"/></td></tr>
	</table>
	</div>
</div>  
    <script src="<%=basePath%>js/win.js" type="text/javascript"></script>
</div>
           
<script  type="text/javascript">
function addQuotation(){
	WIN.show('<font size=5>添加供应商产品报价信息</font>',$('winCon_1'),{width:600,height:350});
}
function editUser(id){
	WIN.show('<font size=5>修改供应商产品报价信息</font>',$('winCon_1'),{width:600,height:400});
	userService.getUserById(id,function(data){
		$('userId0').value=data.id;
		$('userName0').value=data.userName;
		if(data.sex){$N('sex0')[0].checked=true;}else{$N('sex0')[1].checked=true;}
		$('telphone0').value=data.telphone;
		$('dept0').value=data.department.id;		
		$('account0').value=data.account;
		$('role0').value=data.role.id;
		if(data.status){$N('status0')[0].checked=true;}else{$N('status0')[1].checked=true;}		
	})
}
function delUser(id){
	if(confirm("删除用户，将导致用户无法登陆，确定删除 ？")){
		WIN.showpg();
		userService.delUserById(id,{
			callback:function(f){WIN.closepg();alert("删除成功");reload();},
			exceptionHandler:function(message){WIN.closepg();alert("删除失败，请重试");},
			errorHander:function(err){}
		})
	}
}
/*重设置用户密码*/
function resetPass(id){
	if(id==null) alert("请选择要操作用用户!");
	if(confirm("确定重设置用户密码 ？")){
		WIN.showpg();
		userService.resetPass(id,{
			callback:function(f){WIN.closepg();alert("操作成功，设置密码为111111 ");reload();},
			exceptionHandler:function(message){WIN.closepg();alert("操作失败，请重试");},
			errorHander:function(err){}
		})
	}
}

function submitUser(){
	var user={
			id:			$('userId0').value,
			name:		$('name0').value,
			sex:		$N('sex0')[0].checked,
			telphone:	$('telphone0').value,
			dept:		{id:$('dept0').value},
			sign:		$('sign0').value.trim(),
			userType:	$('type0').value,
			status:		$N('status0')[0].checked
	}
	
	if(''==user.sign){alert('账号不能为空');return;}
	if(''==user.dept.id){alert('请选择部门');return;}
	
	if(''==user.id){
		submitUser.user=user;		
		userService.hasSign(user.sign,{
			callback:function(f){if(f){alert('此账号已经存在，请更改');}else{submit(submitUser.user);}},
			exceptionHandler:function(message){WIN.closepg();alert(message);alert("操作失败，请重试");reload();},
			errorHander:function(err){}
		})
	}else{
		submit(user);
	}
}
function submit(user){
	WIN.close();
	WIN.showpg();
	userService.editUser(user,{
		callback:function(f){WIN.closepg();alert("操作成功");reload();},
		exceptionHandler:function(message){WIN.closepg();alert(message);alert("操作失败，请重试");},
		errorHander:function(err){}
	})
}

</script>
</body>
</html>
